﻿package Gameplay.Visualizer 
{
	public class Vertex 
	{
		private var FRadius:Number;
		private var FDegree:Number;
		private var FMutable:Boolean;
		
		private var Fx:Number;
		private var Fy:Number;
		
		public function Vertex(ARadius:Number, ADegree:Number, AMutable:Boolean=true) 
		{
			FRadius = ARadius;
			FDegree = ADegree;
			FMutable = AMutable;
			
			if (!FMutable) 
			{
				Fx = FRadius * Math.cos(FDegree);
				Fy = -FRadius * Math.sin(FDegree);
			}
		}
		
		public function get x():Number 
		{
			if (FMutable) 
			{
				return FRadius * Math.cos(FDegree);
			} 
			else 
			{
				return Fx;
			}
		}
		
		public function get y():Number 
		{
			if (FMutable) 
			{
				return -FRadius * Math.sin(FDegree);
			}
			else 
			{
				return Fy;
			}
		}
	
		public function get Radius():Number
		{
			return FRadius;
		}
	
		public function set Radius(value:Number):void
		{
			if (FMutable)
				FRadius = value;			
		}
	
		public function get Degree():Number
		{
			return FDegree;
		}
	
		public function set Degree(value:Number):void
		{
			if(FMutable)			
				FDegree = value;		
		}
	}
}